<extend name='Public/_Main' />
<block name='right'>
    <!--应用列表-->
    <form id="export-form" method="post">
    <div class='table-responsive'>
        <table class='table table-hover'>
            <thead>
                <tr>
                    <th>备份名称</th>
                    <th>卷数</th>
                    <th>压缩</th>
                    <th>数据大小</th>
                    <th>备份时间</th>
                    <th>状态</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
            <php>
            $html="<tr><td colspan='7'><h3>没有找到备份数据...</h3></td></tr>";
            </php>
                <volist name="list" id="data" empty='$html'>
                    <tr>
                        <td>
                            {$data.time|date='Ymd-His' ,###}
                        </td>
                        <td>
                            {$data.part}
                        </td>
                        <td>
                            {$data.compress}
                        </td>
                        <td>
                            {$data.size|format_bytes}
                        </td>
                        <td>
                            {$key}
                        </td>
                        <td>-</td>
                        <td>
                            <div role="group" class="btn-group">
                                <a href="{:U('import',array('time'=>$data['time']))}" class="btn btn-default import_static">还原</a>
                                <a href="{:U('del',array('time'=>$data['time']))}" class="btn btn-danger getajax">删除备份</a></div>
                        </td>
                    </tr>
                </volist>
            </tbody>
        </table>
        </div>
    </form>
    <!--//应用列表-->
</block>

<block name='script'>
    <script src="__PUBLIC__/Jquery/jquery-1.7.2.min.js"></script>
    <script type="text/javascript">
    $(".import_static").click(function() {
        var self = this,
            status = ".";
        $.get(self.href, success, "json");
        return false;

        function success(data) {
            if (data.status) {
                if (data.gz) {
                    data.info += status;
                    if (status.length === 5) {
                        status = ".";
                    } else {
                        status += ".";
                    }
                }
                $(self).parent().parent().prev().text(data.info);
                if (data.part) {
                    $.get(self.href, {
                            "part": data.part,
                            "start": data.start
                        },
                        success,
                        "json"
                    );
                } else {
                    window.onbeforeunload = function() {
                        return null;
                    }
                }
            } else {
                alert(data.info, 'alert-error');
            }
        }

    });
    </script>
</block>
